Clover coverage report - Enterprise Web Services - 1.0
Coverage timestamp: Mon May 30 2005 17:10:32 CEST
file stats: LOC: 89   Methods: 2
NCLOC: 62   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
EJBGenerator.java 50% 70% 100% 63%
coverage coverage
 1   
 /*
 2   
  * Copyright 2001-2004 The Apache Software Foundation.
 3   
  * 
 4   
  * Licensed under the Apache License, Version 2.0 (the "License");
 5   
  * you may not use this file except in compliance with the License.
 6   
  * You may obtain a copy of the License at
 7   
  * 
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  * 
 10   
  * Unless required by applicable law or agreed to in writing, software
 11   
  * distributed under the License is distributed on an "AS IS" BASIS,
 12   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  * See the License for the specific language governing permissions and
 14   
  * limitations under the License.
 15   
  */
 16   
 
 17   
 package org.apache.geronimo.ews.ws4j2ee.toWs.ejb;
 18   
 
 19   
 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
 20   
 import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
 21   
 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
 22   
 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
 23   
 import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
 24   
 import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
 25   
 import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
 26   
 import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeFactory;
 27   
 
 28   
 /**
 29   
  * <p>This class crete the nessacsaary EJB artifacts</p>
 30   
  *
 31   
  * @author Srinath Perera(hemapani@opensource.lk)
 32   
  */
 33   
 public class EJBGenerator implements Generator {
 34   
     private J2EEWebServiceContext context;
 35   
     private Writer homewriter;
 36   
     private Writer remotewriter;
 37   
     private Writer beanwriter;
 38   
     private Writer ddwriter;
 39   
     private Writer localwriter;
 40   
     private Writer localhomewriter;
 41   
     protected EJBContext ejbcontext;
 42   
     private Ws4J2eeFactory factory;
 43   
 
 44  8
     public EJBGenerator(J2EEWebServiceContext context) throws GenerationFault {
 45  8
         this.context = context;
 46  8
         ejbcontext = context.getEJBDDContext();
 47  8
         if (ejbcontext == null) {
 48  0
             throw new UnrecoverableGenerationFault("for ejbbased Impl" +
 49   
                     " the EJBDDContext must not be null");
 50   
         }
 51  8
         factory = context.getFactory();
 52  8
         String implStyle = context.getMiscInfo().getImplStyle();
 53  8
         if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
 54   
                 || GenerationConstants.USE_REMOTE.equals(implStyle)) {
 55  8
             homewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_HOME_INTERFACE_WRITER);
 56  8
             remotewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_REMOTE_INTERFACE_WRITER);
 57  0
         } else if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
 58   
                 || GenerationConstants.USE_LOCAL.equals(implStyle)) {
 59  0
             localhomewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_LOCAL_HOME_INTERFACE_WRITER);
 60  0
             localwriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_LOCAL_INTERFACE_WRITER);
 61  0
         } else if (GenerationConstants.USE_INTERNALS.equals(implStyle)) {
 62  0
             homewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_HOME_INTERFACE_WRITER);
 63  0
             remotewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_REMOTE_INTERFACE_WRITER);
 64   
         }
 65  8
         if (!context.getMiscInfo().isImplAvalible()) {
 66  2
             beanwriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_IMPLEMENTATION_BEAN_WRITER);
 67   
         }
 68  8
         ddwriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_DD_WRITER);
 69   
     }
 70   
 
 71  8
     public void generate() throws GenerationFault {
 72  8
         if (homewriter != null)
 73  8
             homewriter.write();
 74  8
         if (remotewriter != null)
 75  8
             remotewriter.write();
 76  8
         if (beanwriter != null)
 77  2
             beanwriter.write();
 78  8
         if (ddwriter != null)
 79  8
             ddwriter.write();
 80  8
         if (localwriter != null) {
 81  0
             localwriter.write();
 82   
         }
 83  8
         if (localhomewriter != null) {
 84  0
             localhomewriter.write();
 85   
         }
 86   
     }
 87   
 
 88   
 }
 89